﻿using System;
using System.Linq;
using System.Text.RegularExpressions;

namespace _17.ExtractAllEmailAddressesFromText
{
    class ExtractAllEmailAddressesFromText
    {
        static void Main(string[] args)
        {
            string text = "This is a sample text with Emails like rtertergter@gmail.com or other like asd123_ew4@abv.bg";
            string pattern = @"(\w[-._\w]*\w@\w[-._\w]*\w\.\w{2,3})";
            Regex rgx = new Regex(pattern);
            Match m = rgx.Match(text);
            while (m.Success)
            {
                Console.WriteLine(m);
                m = m.NextMatch();
            }
        }
    }
}
